package com.sca.common.netty.config;

import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;

/**
 * Netty配置属性
 */
@Data
@ConfigurationProperties(prefix = "mask.netty")
public class NettyProperties {
    
    /**
     * 是否开启Netty
     */
    private boolean enabled = true;
    
    /**
     * 服务器配置
     */
    private Server server = new Server();
    
    /**
     * 客户端配置
     */
    private Client client = new Client();
    
    @Data
    public static class Server {
        /**
         * 服务器端口
         */
        private int port = 8888;
        
        /**
         * 服务器地址
         */
        private String host = "0.0.0.0";
        
        /**
         * 是否开启心跳检测
         */
        private boolean heartbeatEnabled = true;
        
        /**
         * 心跳间隔(秒)
         */
        private int heartbeatInterval = 30;
        
        /**
         * 是否开启SSL
         */
        private boolean sslEnabled = false;
        
        /**
         * SSL证书路径
         */
        private String sslCertPath;
        
        /**
         * SSL证书密码
         */
        private String sslPassword;
    }
    
    @Data
    public static class Client {
        /**
         * 服务器地址
         */
        private String host = "localhost";
        
        /**
         * 服务器端口
         */
        private int port = 8888;
        
        /**
         * 是否开启心跳检测
         */
        private boolean heartbeatEnabled = true;
        
        /**
         * 心跳间隔(秒)
         */
        private int heartbeatInterval = 30;
        
        /**
         * 是否开启SSL
         */
        private boolean sslEnabled = false;
        
        /**
         * SSL证书路径
         */
        private String sslCertPath;
        
        /**
         * SSL证书密码
         */
        private String sslPassword;
        
        /**
         * 重连间隔(秒)
         */
        private int reconnectInterval = 5;
        
        /**
         * 最大重连次数
         */
        private int maxReconnectAttempts = 3;
    }
}